home *** CD-ROM | disk | FTP | other *** search
/ Visual FX for Image FX / VisualFX for Image FX 3.adf / Files / ARexx / 03 / 10.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-07-31  |  5.1 KB  |  259 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. PicAName = strip(line)
  22. line = readln(TempFile)
  23. Start = strip(line)
  24. line = readln(TempFile)
  25. End = strip(line)
  26. line = readln(TempFile)
  27. IAType = strip(line)
  28. line = readln(TempFile)
  29. Color = strip(line)
  30. line = readln(TempFile)
  31. BackType = strip(line)
  32. line = readln(TempFile)
  33. XOff = strip(line)
  34. line = readln(TempFile)
  35. YOff = strip(line)
  36. line = readln(TempFile)
  37. BrushName = strip(line)
  38. line = readln(TempFile)
  39. ShapeType = strip(line)
  40. call close TempFile
  41.  
  42. Frames = (End - Start)+1
  43. j=0
  44. k=0
  45. TFrames = Frames
  46. TNum = 3
  47. if TFrames > 999 then TNum = 4
  48. if TFrames > 9999 then TNum = 5
  49. if Field = 1 then TFrames = Frames*2
  50. do i = Start to End
  51.     k = k+ 1
  52.     call open TempFile,"RAM:VFXNums",W
  53.     call writeln TempFile,right(k,5,'0')
  54.     call writeln TempFile,right(Frames,5,'0')
  55.     call close TempFile
  56.     f=0
  57.     Redraw Off
  58.     j = j+ 1
  59.     FieldSet = 0
  60.     call DoIt()
  61.     Redraw On
  62.     call SaveIt()
  63.         if Field = 1 then do
  64.             Redraw Off
  65.             j = j + 1
  66.             FieldSet = 1
  67.             call DoIt()
  68.             Redraw On
  69.             call SaveIt()
  70.             end 
  71.     end
  72.     Undo On
  73. exit
  74.  
  75.  
  76.  
  77. LoadA:
  78.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  79.         Undo On
  80.         exit
  81.         end
  82.     if IAType = 0 then do
  83.         LoadBuffer PicAName Force i
  84.         if Field = 1 then do
  85.             GetMain
  86.             parse var result Name Width Height Blah
  87.             if FieldSet = 0 then do
  88.                 Hook DeInterlace
  89.                 Scale Width Height
  90.                 end
  91.             if FieldSet = 1 then do
  92.                 Hook DeInterlace
  93.                 Swap
  94.                 Scale Width Height
  95.                 end
  96.             end
  97.         end
  98.     if IAType = 1 then do
  99.         LoadBuffer PicAName Force 1
  100.         end
  101.     if IAType = 2 then do
  102.         LoadBuffer PicAName Force
  103.         end
  104.     if IAType = 3 then do
  105.         LoadBuffer PicAName""right(i,TNum,'0') Force
  106.         end
  107. return
  108.  
  109.  
  110. SaveIt:
  111.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  112.         Undo On
  113.         exit
  114.         end
  115.     if SaveType = 0 then do
  116.         call Switcher(TOSW)
  117.         call Switcher(MDV1)
  118.  
  119.         Render Go
  120.         if Field = 1 then
  121.                 call RecordAdd(SaveName,1,6,Compression)
  122.         else
  123.                 call RecordAdd(SaveName,2,6,Compression)
  124.         if j = TFrames then
  125.             call MakeIcon(SaveName,(Frames-10))
  126.         end
  127.  
  128.     if SaveType = 1 then do
  129.         if Field = 1 then do
  130.             f= f + 1
  131.             if f = 1 then
  132.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  133.             if f = 2 then do
  134.                 GetMain
  135.                 parse var result Name Width Height Blah
  136.                 Scale Width Height/2
  137.                 Swap
  138.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  139.                 Scale Width Height/2
  140.                 Hook Interlace
  141.                 SaveBufferAs ILBM SaveName""right(k,TNum,'0')
  142.                 f = 0
  143.                 end
  144.             end
  145.         else do
  146.             SaveBufferAs ILBM SaveName""right(k,TNum,'0')
  147.             end    
  148.         end
  149.  
  150. return
  151.  
  152.  
  153. DoIt:
  154.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  155.         Undo On
  156.         exit
  157.         end
  158.     call LoadA()
  159.     GetMain
  160.     parse var result Name Width Height Blah
  161.     Buffer2Swap
  162.     Swap
  163.     if BackType = 2 then do
  164.         LoadBuffer BrushName Force
  165.         GetMain
  166.         parse var result Name NewWidth NewHeight Blah
  167.         if NewWidth ~= Width | NewHeight ~= Height then Scale Width Height
  168.         end
  169.     if BackType < 2 then do
  170.         if j = 1 then do
  171.             LoadBrush BrushName
  172.             SaveBrushAs "ILBM" "VFXIFX:TempDrawer/BrushA" 
  173.             end
  174.         if j > 1 then do
  175.             LoadBrush "VFXIFX:TempDrawer/BrushA" 
  176.             Roll XOff YOff
  177.             SaveBrushAs "ILBM" "VFXIFX:TempDrawer/BrushA" 
  178.             end
  179.  
  180.         Region Full
  181.         DrawMode Normal
  182.         Blend 100
  183.         FillMode Tile 0 0 0 Smooth
  184.         FilledBox 0 0 Width Height
  185.         FillMode Solid 0 0 0 Smooth
  186.         if BackType = 1 then do
  187.             DrawMode Colorize
  188.             ActiveColor Color
  189.             FilledBox 0 0 Width Height
  190.             end
  191.         ActiveColor 1
  192.         DrawMode Normal
  193.         KillBrush
  194.         end
  195.     ActiveColor 1
  196.     DrawMode Darken
  197.  
  198.     if ShapeType = 0 then do
  199.         A = trunc(Width/10)+12
  200.         B = trunc(Height/10)+12
  201.         C = trunc(Width - (A*2))
  202.         D = trunc(Height - (B*2))
  203.         FilledBox A+12 B+10 C D
  204.         FilledBox A+12 B+10 C D
  205.         end
  206.     if ShapeType = 1 then do
  207.         EdgeMode FeatherOut 2
  208.         FilledOval (Width/2)+12 (Height/2)+10 (Height/2)-10 (Height/2)-40
  209.         FilledOval (Width/2)+12 (Height/2)+10 (Height/2)-10 (Height/2)-40
  210.         end
  211.     if ShapeType = 2 then do
  212.         EdgeMode FeatherOut 2
  213.         FilledOval (Width/2)+12 (Height/2)+10 (Width/2)-60 (Height/2)-40
  214.         FilledOval (Width/2)+12 (Height/2)+10 (Width/2)-60 (Height/2)-40
  215.         end
  216.     if ShapeType = 3 then do
  217.         EdgeMode FeatherOut 2
  218.         NewArea
  219.         AddArea (Width/2)+20 20
  220.         AddArea (Width-40)+20 (Height/2)
  221.         AddArea (Width/2)+20 (Height-20)
  222.         AddArea 40+20 (Height/2)
  223.         FilledPoly
  224.         end
  225.  
  226.     DrawMode Normal
  227.     Swap
  228.     AlphaChannel Off
  229.     Buffer2Alpha
  230.     SwapAlpha
  231.     Clearbuffer Force 0 0 0
  232.  
  233.     if ShapeType = 0 then do
  234.         FilledBox A B C D
  235.         end
  236.     if ShapeType = 1 then do
  237.         FilledOval Width/2 Height/2 (Height/2)-10 (Height/2)-40
  238.         end
  239.     if ShapeType = 2 then do
  240.         FilledOval Width/2 Height/2 (Width/2)-60 (Height/2)-40
  241.         end
  242.     if ShapeType = 3 then do
  243.         NewArea
  244.         AddArea Width/2 20
  245.         AddArea Width-40 Height/2
  246.         AddArea Width/2 Height-20
  247.         AddArea 40 Height/2
  248.         FilledPoly
  249.         end
  250.     Negative
  251.     SwapAlpha
  252.     AlphaChannel FRISKET
  253.     Merge 100 Alpha
  254.     AlphaChannel Off
  255.     EdgeMode Normal
  256. return
  257.  
  258.  
  259.